package org.fujay.commons.langchain4j.constant;

import dev.langchain4j.model.input.PromptTemplate;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * @author slm
 * @description
 */
@Getter
@AllArgsConstructor
public enum PromptTypeEnum {

    BASE_PROMPT("1", PromptConstants.BASE_PROMPT) {
        @Override
        public String buildPrompt(Map<String, String> param, String template) {
            return PromptTemplate.from(this.getTemplate()).apply(param).text();
        }
    },
    EXPERTISE_PROMPT("2", PromptConstants.EXPERTISE_PROMPT) {
        @Override
        public String buildPrompt(Map<String, String> param, String template) {
            return PromptTemplate.from(this.getTemplate()).apply(param).text();
        }
    },
    OPTIMIZE_PROMPT("3", PromptConstants.OPTIMIZE_PROMPT) {
        @Override
        public String buildPrompt(Map<String, String> param, String template) {
            return PromptTemplate.from(this.getTemplate()).apply(param).text();
        }
    },
    CUSTOM_PROMPT("4", "") {
        @Override
        public String buildPrompt(Map<String, String> param, String template) {
            return PromptTemplate.from(template).apply(param).text();
        }
    };

    private final String code;

    private final String template;

    public abstract String buildPrompt(Map<String, String> param, String template);
}
